﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Protocol
{
    public class ResLogin
    {
        public int Result;

        public byte[] Encode()
        {
            byte[] buffer;
            using (MemoryStreamExt ms = new MemoryStreamExt())
            {
                ms.WriteInt(Result);
                ms.Seek(0, System.IO.SeekOrigin.Begin);
                buffer = new byte[ms.Length];
                buffer = ms.ToArray();
            }
            return buffer;
        }

        public static ResLogin Decode(byte[] buffer)
        {
            ResLogin dto = new ResLogin();
            using (MemoryStreamExt ms = new MemoryStreamExt(buffer))
            {
                dto.Result = ms.ReadInt();
            }
            return dto;
        }
    }
}
